<template>
	<view>
		<view class="bg">
			
      <image v-if="phone != ''" src="../../static/images/logo.png" class='headpic'></image>
      <view v-if="phone != ''" class='name'>{{phone}}</view>
	  
	  <image v-if="phone == ''" src="../../static/images/logo.png" class='headpic' @click="login()"></image>
	  <view v-if="phone == ''" class='name' @click="login()">点击登录</view>
	   
    </view>
	
    <navigator v-if="phone != ''" class='nav-line' @click="gotob()">
      <text>我的报名</text>
      <text>></text>
    </navigator>
	
	<navigator v-if="phone == ''" class='nav-line' @click="login()">
	  <text>我的报名</text>
	  <text>></text>
	</navigator>
	
	<navigator v-if="phone != ''" class='nav-line' @click="relogin()">
	  <text>退出登录</text>
	  <text>></text>
	</navigator>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				phone:""
			}
		},
		onShow(option) {
			this.phone = uni.getStorageSync('phone')
		},
		methods: {
			login(){
				uni.navigateTo({
				    url: "../login/login"
				});
			},
			gotob(){
				uni.navigateTo({
				    url: "../userinfo/userinfo"
				});
			},
			relogin(){
				uni.removeStorage({
				    key: 'phone',
				    success: function (res) {
				        uni.switchTab({
				            url: "../index/index"
				        });
				    }
				});
			}
		},
    onPullDownRefresh() {
      uni.stopPullDownRefresh()
    }
	}
</script>

<style lang="scss">
  .bg {
    height: 439upx;
    background: url(../../static/images/me-bg.png) no-repeat;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    .headpic {
      width: 174upx;
      height: 174upx;
      border: 3px solid #fff;
      border-radius: 200upx;
      margin-bottom: 10px;
    }
  }
  .nav-line {
    font-size: 16px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
	border-bottom:1px solid #ddd;
  }
</style>
